package com.bjxst;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

/**通过转换流实现键盘输入屏幕输出
 * InputStreamReader/OutputStreamWriter 用来实现将字节流转化成字符流*/
public class ConvertStream02 {
    public static void main(String[] args) {
        BufferedReader br = null;
        BufferedWriter bw = null;
        try{
            br = new BufferedReader(new InputStreamReader(System.in));
            bw = new BufferedWriter(new OutputStreamWriter(System.out));
            /*String input = br.readLine();
            bw.write(input);
            bw.flush();*/
            while (true){
                bw.write("请输入：");
                bw.flush();
                String input = br.readLine();
                if("exit".equals(input)){
                    break;
                }
                bw.write("你输入的是："+input);
                bw.newLine();
                bw.flush();
            }
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            try{
                if(br != null){
                    br.close();
                }
                if(bw != null){
                    bw.close();
                }
            }catch (Exception e){
                e.printStackTrace();
            }
        }
    }
}
